import React from "react";
export default class Demo extends React.Component {
	//组件中的三大属性,state props ref
	//state 值是一个对象,存放数据,乘坐[状态]
	//数据驱动视图(view--页面)
	state = {
		isEat: true,
	};
	render() {
		return (
			// <div>
			// 	<h1>这是demo组件</h1>
			// </div>
			<div>
				<h1>今天吃热干面吗?{this.state.isEat ? "吃" : "不吃"}</h1>
				<button
					onClick={() => {
						this.setState({
							isEat: !this.state.isEat,
							str: "react",
						});
						console.log(this.state.isEat);
					}}
				>
					在考虑一下吧
				</button>
			</div>
		);
	}
}
